<template>
  <div>
    <button @click="routerFn">路由传参</button>
  </div>
</template>
<script>
import { defineComponent, ref } from "vue";
import { useRouter } from "vue-router";
export default defineComponent({
  name: "home",
  setup() {
    const userRouter = useRouter();
    let name = ref("zhihui");
    let age = ref(30);

    let routerFn = () => {
      userRouter.push({
        // name:'About',
        path: "/about",
        params: {
          name: name.value,
          age: age.value,
        },
      });
    };
    return {
      routerFn,
    };
  },
});
</script>
